<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>PROJEKT Z PRZEDMIOTU SYSTEMY KOMPUTEROWE (SYKO) grupa nr. 16: Plik źródłowy C:/Users/Krzysiek/Desktop/[SYKO]PROJEKT/project_uC_AVR_v2/f_brcc.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Wygenerowano przez Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Szukaj');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">PROJEKT Z PRZEDMIOTU SYSTEMY KOMPUTEROWE (SYKO) grupa nr. 16&#160;<span id="projectnumber">0.01</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Strona&#160;główna</span></a></li>
      <li><a href="pages.html"><span>Dodatkowe&#160;strony</span></a></li>
      <li><a href="modules.html"><span>Moduły</span></a></li>
      <li class="current"><a href="files.html"><span>Pliki</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Szukaj" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Lista&#160;plików</span></a></li>
      <li><a href="globals.html"><span>Globalne</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">C:/Users/Krzysiek/Desktop/[SYKO]PROJEKT/project_uC_AVR_v2/f_brcc.c</div>  </div>
</div>
<div class="contents">
<a href="f__brcc_8c.html">Idź do dokumentacji tego pliku.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">================================================================================</span>
<a name="l00003"></a>00003 <span class="comment">        Plik: f_brcc.c</span>
<a name="l00004"></a>00004 <span class="comment">--------------------------------------------------------------------------------</span>
<a name="l00005"></a>00005 <span class="comment">        Autorzy: Piotr Zdunek, Mateusz Słowikowski, Krzysztof Wiąckowski</span>
<a name="l00006"></a>00006 <span class="comment">        Projekt:Model mikrokontrolera AVR</span>
<a name="l00007"></a>00007 <span class="comment">        Kompilator: avr-gcc-4.3.5</span>
<a name="l00008"></a>00008 <span class="comment">        Doc: doxygen 1.7.4</span>
<a name="l00009"></a>00009 <span class="comment">--------------------------------------------------------------------------------</span>
<a name="l00010"></a>00010 <span class="comment">        Zawiera:</span>
<a name="l00011"></a>00011 <span class="comment">--------------------------------------------------------------------------------</span>
<a name="l00012"></a>00012 <span class="comment">        Komentarze:</span>
<a name="l00013"></a>00013 <span class="comment">================================================================================</span>
<a name="l00014"></a>00014 <span class="comment">*/</span>
<a name="l00015"></a>00015 
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="types_8h.html" title="Biblioteka typów.">types.h</a>&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;mem_abs.h&quot;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="comment">/*</span>
<a name="l00024"></a>00024 <span class="comment"> * Funkcja BRCC Branch if Carry Cleared. Branch czyli skok. Jeśli w wyniku poprzedni0</span>
<a name="l00025"></a>00025 <span class="comment"> * wykonanej operacji została wyzerowana flaga C, to ma być skok do innego adresu. Czyli ma być</span>
<a name="l00026"></a>00026 <span class="comment"> * Zwiększone PC k o k. K zawiera się w przedziale (-64,+64). Nie testowałem czy działa do tyłu, ale</span>
<a name="l00027"></a>00027 <span class="comment"> * teoretycznie powinno.</span>
<a name="l00028"></a>00028 <span class="comment"> *</span>
<a name="l00029"></a>00029 <span class="comment"> * Przykład kodu assemblera, który testuje tę funkcję</span>
<a name="l00030"></a>00030 <span class="comment"> *</span>
<a name="l00031"></a>00031 <span class="comment"> * add r5,r6 ; r5 = 5,r6 = 9</span>
<a name="l00032"></a>00032 <span class="comment"> * branch przep</span>
<a name="l00033"></a>00033 <span class="comment"> * and r1,r2</span>
<a name="l00034"></a>00034 <span class="comment"> * and r2,r3</span>
<a name="l00035"></a>00035 <span class="comment"> * and r3,r4</span>
<a name="l00036"></a>00036 <span class="comment"> * ...</span>
<a name="l00037"></a>00037 <span class="comment"> * przep: nop</span>
<a name="l00038"></a>00038 <span class="comment"> * and r1,r2 &lt;- test czy kolejna operacja się wykoan</span>
<a name="l00039"></a>00039 <span class="comment"> *</span>
<a name="l00040"></a>00040 <span class="comment"> */</span>
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="f__brcc_8c.html#a0f4198eb9c2046726fefe0406dc9e39d">00042</a> <span class="keywordtype">void</span> <a class="code" href="f__brcc_8c.html#a0f4198eb9c2046726fefe0406dc9e39d">F_BRCC</a>(<span class="keywordtype">void</span>){
<a name="l00043"></a>00043 
<a name="l00053"></a>00053 <span class="preprocessor">        #if DEBUG_MODE</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>                printf(<span class="stringliteral">&quot;Function BRCC.&quot;</span>);
<a name="l00055"></a>00055                 printf(<span class="stringliteral">&quot;PC = %lx\n&quot;</span>,getPC());
<a name="l00056"></a>00056 <span class="preprocessor">        #endif</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a>00058         <span class="keywordtype">int</span> k_temp = (getMEMC(getPC()) &amp; 0x0FFF);
<a name="l00059"></a>00059         <a class="code" href="group__typy.html#ga07e6386c22b516c64e410b35f545f31f" title="osmiobitowy typ danych o wartosciach od -64 do 64.">int8_t</a> k = (k_temp &amp; 0b001111111000) &gt;&gt; 3;      <span class="comment">// maska zgodnie z instruction set manual</span>
<a name="l00060"></a>00060                                                                                                         <span class="comment">//      wyłuskanie wartosci zmiennej k (offsetu)</span>
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 <span class="preprocessor">        #if DEBUG_MODE</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span>                printf(<span class="stringliteral">&quot;k %x\n&quot;</span>,k);
<a name="l00064"></a>00064 <span class="preprocessor">        #endif</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span>
<a name="l00066"></a>00066 <span class="preprocessor">        #if DEBUG_MODE</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span>                printf(<span class="stringliteral">&quot;k %d %x\n&quot;</span>,k,k);
<a name="l00068"></a>00068                 <span class="comment">//ClearFlagRegisterBit(FLAG_C);</span>
<a name="l00069"></a>00069 <span class="preprocessor">        #endif</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="comment">// Sprawdzenie warunku ustawienia flagi C</span>
<a name="l00071"></a>00071 <span class="comment">// jeśli warunek jest spełniony to skok o k</span>
<a name="l00072"></a>00072 <span class="comment">// jeśli nie to skok o 1</span>
<a name="l00073"></a>00073         <span class="keywordflow">if</span>( GetFlagRegisterStatus(<a class="code" href="group__flagi.html#gad46c6da50a6f244180853e079f2514d2" title="Definicja flagi C.">FLAG_C</a>) == 0) incPC_k(k);
<a name="l00074"></a>00074         <span class="keywordflow">else</span> incPC();
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="preprocessor">        #if DEBUG_MODE</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span>                printf(<span class="stringliteral">&quot;PC = %x\n&quot;</span>,getPC());
<a name="l00078"></a>00078 <span class="preprocessor">        #endif</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span>        <span class="comment">//do teststów!!!!</span>
<a name="l00080"></a>00080         <span class="comment">//setPC();</span>
<a name="l00081"></a>00081 }
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Pliki</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Funkcje</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Definicje typów</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Definicje</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Wygenerowano Mon Jun 6 2011 20:13:45 dla PROJEKT Z PRZEDMIOTU SYSTEMY KOMPUTEROWE (SYKO) grupa nr. 16 programem&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
